import request from '@/utils/request'

export function courses() {
  return request({
    url: '/course/index',
    method: 'GET',
    params: {}
  })
}

export function update(data) {
  var params = new URLSearchParams()
  params.append('id', data.id)
  params.append('name', data.name)
  params.append('theme', data.theme)
  return request({
    url: '/course/' + data.id + '/update',
    method: 'put',
    params
  })
}

export function getFees(courseID) {
  return request({
    url: '/' + courseID + '/fees',
    method: 'GET'
  })
}
// export function saveFees(param) {
//   var params = new URLSearchParams()
//   params.append('rules', param)
//   return request({
//     url: '/course/feeRules/update',
//     method: 'post',
//     params
//   })
// }
export function saveFees(param) {
  return request.post('/course/feeRules/update', param)
}
